home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / DIRS.SWG / 0031_Recursing ALL Dirs.pas < prev    next >
Pascal/Delphi Source File  |  1994-08-24  |  581b  |  26 lines

  1.  
  2.   uses dos;
  3.   procedure ProcessAllFiles(dir : dirstr);
  4.   var
  5.     d : searchrec;
  6.  
  7.   begin
  8.     while (dir[length(dir)] = '\') do dec(dir[0]);
  9.  
  10.     { this gets the files }
  11.     findfirst(dir+'\*.*',anyfile+hidden+system+readonly,d);
  12.     while (doserror = 0) do begin
  13.       process(d.name);
  14.       findnext(d);
  15.     end;
  16.  
  17.     { this gets the subs, recursively }
  18.     findfirst(dir+'\*.*',directory,d);
  19.     while (doserror = 0) do begin
  20.       if (d.attr and directory = directory) then
  21.         ProcessAllFiles(dir+'\'+d.name);
  22.       findnext(d);
  23.     end;
  24.  
  25.   end;
  26.